Updated a null error, will fix the query function with debugging later