 	thumb: (Model, pk) ->
 		module.exports.content(Model, pk)
 			.then (file) ->
-				if not module.exports.isImg(file.prop.filename)
-					return reject 'Attachment is not an image file'
-				file.prop.filename = sails.services.file.thumbName file.prop.filename 
+				if not module.exports.isImg file.prop
+					return Promise.reject 'Attachment is not an image file'
+				file.prop.filename = sails.services.file.thumbName file.prop.filename
 				new Promise (resolve, reject) ->
 					file.stream
 						.pipe sails.services.img.thumb()

				.then (data) ->
					fulfill data[field]
				.catch reject
		
	# get {name: filename, stream: stream} of file content from gridfs
	content: (Model, pk) ->
		getMsg = (id) ->

						readable = new stream.PassThrough()
						readable.end(data)
						resolve readable

		getMsg(pk).then (msg) ->
			getFile(msg).then (file) ->
				getReader(file).then (stream) ->
