fixed slice + better checking on functions arguments