Minor fixes for function creation