small function fixes