 	'$log', '$injector', '$rootScope', '$timeout', '$q', '$parse'
 	(console, $injector, $rootScope, $timeout, $q, $parse) ->
 
+		log = console.debug || console.log
+
 		# Element manipulation routines
 
 		insertElement =
 			(newElement, previousElement) ->
-				previousElement.after.apply(previousElement, [newElement])
+				previousElement.after newElement
 				[]
 
 		removeElement = (wrapper) ->

						wrapper.scope.$destroy()
					]


		# buffer

		Buffer = (itemName, $scope, linker)->

			buffer = Object.create Array.prototype

		terminal: true

		compile: (elementTemplate, attr, compileLinker) ->

			unless match = attr.uiScroll.match(/^\s*(\w+)\s+in\s+([\w\.]+)\s*$/)
				throw new Error 'Expected uiScroll in form of \'_item_ in _datasource_\' but got \'' + $attr.uiScroll + '\''
