Fixed a bug in return statement where wrong argument was being passed to splice function.